package com.gome.ocean.common.constants;

/**
 * 愚公常亮类
 * 
 * @author haqiaolong 2016年6月17日 下午3:07:34
 * @since 5.0.0
 */
public class YugongContants {

    public static final String  YUGONG_BIN           = "/bin/";
    public static final String  YUGONG_CONF          = "/conf/";
    public static final String  YUGONG_LOGS          = "/logs/";
    public static final String  YUGONG_START         = "startup.sh";
    public static final String  YUGONG_WINDOWS_START = "startup.bat";
    public static final String  YUGONG_STOP          = "stop.sh";
    private static final String REMOTE_YUGONG_START  = "http://%s:8081/datax-console/api/yugong/start?taskId=%d";
    private static final String REMOTE_YUGONG_STOP   = "http://%s:8081/datax-console/api/yugong/stop?taskId=%d";
    private static final String YUGONG_SH            = "sh ";

    public static String getRemoteYugongStartPath(String serviceIp, Long taskId) {
        return String.format(REMOTE_YUGONG_START, serviceIp, taskId);
    }

    public static String getRemoteYugongStopPath(String serviceIp, Long taskId) {
        return String.format(REMOTE_YUGONG_STOP, serviceIp, taskId);
    }

    public static String getYugongBinPath(String homePath) {
        return homePath.concat(YUGONG_BIN);
    }

    public static String getYugongConfPath(String homePath) {
        return homePath.concat(YUGONG_CONF);
    }

    public static String getYugongLogPath(String homePath) {
        return homePath.concat(YUGONG_LOGS);
    }

    public static String getYugongStart(String homePath) {
        return YUGONG_SH.concat(getYugongBinPath(homePath).concat(YUGONG_START));
    }

    public static String getYugongStop(String homePath) {
        return YUGONG_SH.concat(getYugongBinPath(homePath).concat(YUGONG_STOP));
    }
}
